package com.joseph.test;

import java.util.HashMap;
import java.util.Map;

/**
 * @description 
 * @author Joseph_Mok
 * @date 2016年3月17日下午4:10:31
 */
public class PublishOffice {

	private Map <String,Writer> writers;
	
	private static PublishOffice instance;
	
	private PublishOffice() {
		writers = new HashMap <String,Writer> ();
	}
	
	public static synchronized PublishOffice getInstance() {
		if (instance == null) {
			instance = new PublishOffice();
		}
		return instance;
	}
	
	public Writer getWriter(String writerName) {
		return writers.get(writerName);
	}
	
	public void addWriter(Writer writer) {
		writers.put(writer.getWriterName(), writer);
	}
	
}
